export const Local = (name: string, obj: { [key: string]: any }) => {
  let res: any = localStorage.getItem(name);
  if (!res) {
    localStorage.setItem(name, JSON.stringify(obj));
  }
  return {
    get: () => {
      return JSON.parse(localStorage.getItem(name) || '');
    },
    set: (val: any) => {
      localStorage.setItem(name, JSON.stringify(val));
    }
  }
}

export const getNowTime = () => {
  return `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate()).padStart(2, '0')} ${String(new Date().getHours()).padStart(2, '0')}:${String(new Date().getMinutes()).padStart(2, '0')}:${String(new Date().getSeconds()).padStart(2, '0')}`
}